// File:    Endereco.cs
// Author:  Lucas Bittencourt
// Created: quarta-feira, 16 de novembro de 2011 18:32:47
// Purpose: Definition of Class Endereco

using System;
using System.Text;

namespace DA_OOMModel
{
   public class Endereco
   {
       private int endIdEndereco;
      private string endNmLogradouro;
      private string endDsComplemento;
      private string endNuImovel;
      private string endNmBairro;
      private string endNuCep;

      private Cidade cidade;
      
      /// <summary>
      /// Property for Cidade
      /// </summary>
      /// <pdGenerated>Default opposite class property</pdGenerated>
      public virtual Cidade Cidade
      {
         get
         {
            return cidade;
         }
         set
         {
               this.cidade = value;
         }
      }
      private Pessoa pessoa;
      
      /// <summary>
      /// Property for Pessoa
      /// </summary>
      /// <pdGenerated>Default opposite class property</pdGenerated>
      public virtual Pessoa Pessoa
      {
         get
         {
            return pessoa;
         }
         set
         {
               this.pessoa = value;
         }
      }
      private Estado estado;
      
      /// <summary>
      /// Property for Estado
      /// </summary>
      /// <pdGenerated>Default opposite class property</pdGenerated>
      public virtual Estado Estado
      {
         get
         {
            return estado;
         }
         set
         {
               this.estado = value;
         }
      }
   
      /// <summary>
      /// Get value of property EndIdEndereco.
      /// </summary>
      public virtual int EndIdEndereco
      {
         get
         {
            return endIdEndereco;
         }
         set
         {
            if (this.endIdEndereco != value)
               this.endIdEndereco = value;
         }
      }
      
      /// <summary>
      /// Get value of property EndNmLogradouro.
      /// </summary>
      public virtual string EndNmLogradouro
      {
         get
         {
            return endNmLogradouro;
         }
         set
         {
            if (this.endNmLogradouro != value)
               this.endNmLogradouro = value;
         }
      }
      
      /// <summary>
      /// Get value of property EndDsComplemento.
      /// </summary>
      public virtual string EndDsComplemento
      {
         get
         {
            return endDsComplemento;
         }
         set
         {
            if (this.endDsComplemento != value)
               this.endDsComplemento = value;
         }
      }
      
      /// <summary>
      /// Get value of property EndNuImovel.
      /// </summary>
      public virtual string EndNuImovel
      {
         get
         {
            return endNuImovel;
         }
         set
         {
            if (this.endNuImovel != value)
               this.endNuImovel = value;
         }
      }
      
      /// <summary>
      /// Get value of property EndNmBairro.
      /// </summary>
      public virtual string EndNmBairro
      {
         get
         {
            return endNmBairro;
         }
         set
         {
            if (this.endNmBairro != value)
               this.endNmBairro = value;
         }
      }
      
      /// <summary>
      /// Get value of property EndNuCep.
      /// </summary>
      public virtual string EndNuCep
      {
         get
         {
            return endNuCep;
         }
         set
         {
            if (this.endNuCep != value)
               this.endNuCep = value;
         }
      }
   
      /// <summary>
      /// Get and set primary key class
      /// </summary>
      public virtual EnderecoPK EnderecoPK
      {
         get 
         {
            return new EnderecoPK(endIdEndereco);
         }
         set
         {
            if (value != null)
            {
               this.endIdEndereco = value.EndIdEndereco;
            }
         }
      }
   
      /// <summary>
      /// Get hash code
      /// </summary>
      /// <pdGenerated>Get hash code</pdGenerated>
      public override int GetHashCode()
      {
         int _hashCode = 0;
         _hashCode = 29 * EnderecoPK.GetHashCode();
         if (this.endNmLogradouro != null) 
            _hashCode += 29 * endNmLogradouro.GetHashCode();
      
         if (this.endDsComplemento != null) 
            _hashCode += 29 * endDsComplemento.GetHashCode();
      
         if (this.endNuImovel != null) 
            _hashCode += 29 * endNuImovel.GetHashCode();
      
         if (this.endNmBairro != null) 
            _hashCode += 29 * endNmBairro.GetHashCode();
      
         if (this.endNuCep != null) 
            _hashCode += 29 * endNuCep.GetHashCode();
         return _hashCode;
      }
   
      /// <summary>
      /// Test if two objects are equal
      /// </summary>
      /// <param name="object">Object to compare</param>
      /// <pdGenerated>Test if two objects are equal</pdGenerated>
      public override bool Equals(object obj)
      {
         if (obj == null)
            return false;
         Endereco cast = obj as Endereco;
         if (!(obj is Endereco))
            return false;
         if (!this.EnderecoPK.Equals(cast.EnderecoPK))
            return false;
         if (this.endIdEndereco != cast.EndIdEndereco)
            return false;
         if (String.Equals(this.endNmLogradouro, cast.EndNmLogradouro) == false)
            return false;
      
         if (String.Equals(this.endDsComplemento, cast.EndDsComplemento) == false)
            return false;
      
         if (String.Equals(this.endNuImovel, cast.EndNuImovel) == false)
            return false;
      
         if (String.Equals(this.endNmBairro, cast.EndNmBairro) == false)
            return false;
      
         if (String.Equals(this.endNuCep, cast.EndNuCep) == false)
            return false;
      
      
         return true;
      }
   
      /// <summary>
      /// Get object in string format
      /// </summary>
      /// <pdGenerated>Get object in string format</pdGenerated>
      public override string ToString()
      {
         StringBuilder ret = new StringBuilder();
         ret.Append( "Endereco: " );
         ret.Append( "EndIdEndereco='" + endIdEndereco.ToString() + "'");
         if (endNmLogradouro != null)
            ret.Append( "EndNmLogradouro='" + endNmLogradouro.ToString() + "'");
         if (endDsComplemento != null)
            ret.Append( "EndDsComplemento='" + endDsComplemento.ToString() + "'");
         if (endNuImovel != null)
            ret.Append( "EndNuImovel='" + endNuImovel.ToString() + "'");
         if (endNmBairro != null)
            ret.Append( "EndNmBairro='" + endNmBairro.ToString() + "'");
         if (endNuCep != null)
            ret.Append( "EndNuCep='" + endNuCep.ToString() + "'");
         return ret.ToString();
      }
   
   }
}